<?php

use yii\helpers\Html;
use yii\widgets\DetailView;

/* @var $this yii\web\View */
/* @var $model backend\models\Appoints */

$this->title = Yii::t('app', 'Appoint Information');
$this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Appoints'), 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
\yii\web\YiiAsset::register($this);
?>
<div class="appoints-view">

    <?= DetailView::widget([
        'model' => $model,
        'attributes' => [
            ['attribute' => 'appointId', 'value' => function($model){return empty($model->appointId) ? '' : $model->appointId;}],
            ['attribute' => 'memberId', 'value' => function($model){return empty($model->memberId) ? '' : $model->memberId;}],
            ['attribute' => 'appointInteval', 'value' => function($model){return empty($model->appointInteval) ? '' : $model->appointInteval;}],
            ['attribute' => 'appointNo', 'value' => function($model){return empty($model->appointNo) ? '' : $model->appointNo;}],
            ['attribute' => 'qrcode', 'value' => function($model){return empty($model->qrcode) ? '' : '<img width="50" src="'.$model->qrcode.'"/>';}, 'format' => 'html'],
            ['attribute' => 'status', 'value' => function($model){
                switch($model->status){
                    case 0:return '未使用';break;
                    case 1:return '预约成功';break;
                    case 2:return '预约失败';break;
                    default:return '未知状态';break;
                } 
            }],
            ['attribute' => 'useStatus', 'value' => function($model){
                switch($model->useStatus){
                    case 0:return '未使用';break;
                    case 1:return '已核销';break;
                    case 2:return '已延期';break;
                    case 3:return '已过期';break;
                    default:return '未知状态';break;
                } 
            }],
            ['attribute' => 'changeTimes', 'value' => function($model){return empty($model->changeTimes) ? '' : $model->changeTimes;}],
            ['attribute' => 'created_at', 'value' => function($model){return empty($model->created_at) ? '' : date('Y-m-d H:i:s', $model->created_at);}],
            ['attribute' => 'success_at', 'value' => function($model){return empty($model->success_at) ? '' : date('Y-m-d H:i:s', $model->success_at);}],
            ['attribute' => 'off_at', 'value' => function($model){return empty($model->off_at) ? '' : date('Y-m-d H:i:s', $model->off_at);}],
            ['attribute' => 'delay_at', 'value' => function($model){return empty($model->delay_at) ? '' : date('Y-m-d H:i:s', $model->delay_at);}],
            ['attribute' => 'cancel_at', 'value' => function($model){return empty($model->cancel_at) ? '' : date('Y-m-d H:i:s', $model->cancel_at);}],
            ['attribute' => 'error', 'value' => function($model){return empty($model->error) ? '' : $model->error;}],
            ['attribute' => 'appointKey', 'value' => function($model){return empty($model->appointKey) ? '' : $model->appointKey;}],
            ['attribute' => 'openId', 'value' => function($model){return empty($model->openId) ? '' : $model->openId;}],
        ],
    ]) ?>

</div>
